package org.raymond.iworks.repository.entity.enums;

import lombok.Getter;

import java.util.Objects;

public enum SexEnum {
    SECRET("secret"),
    MALE("male"),
    FEMALE("female");

    @Getter
    private final String code;

    SexEnum(String code){
        this.code = code;
    }

    public static SexEnum getByCode(String code) {
        for (SexEnum e: SexEnum.values()) {
            if (Objects.equals(code, e.getCode())) {
                return e;
            }
        }
        return null;
    }
}
